<?php
namespace Admin\Controller;
/**
 * 会员列表
 * User: linkwhy
 * Date: 2015/10/19
 * Time: 14:30
 */
class MemberController extends AdminController{

    public function index(){
        $list   = $this->lists('clients', '', '', 'id,uid,open_name,bank_account,open_bank_name');
        int_to_string($list);
        $address = M('clients_address');
        foreach($list as $key => &$val){
            $row = $address->field('name,phone,pro_id,city_id,area_id,address')->where(array('default' => 1, 'cid' => $val['uid']))->find();
            $val['name'] = $row['name'];
            $val['phone'] = $row['phone'];
            $val['pro_id'] = $row['pro_id'];
            $val['city_id'] = $row['city_id'];
            $val['area_id'] = $row['area_id'];
            $val['address'] = $row['address'];
        }
        $this->assign('_list', $list);
        $this->meta_title = '会员列表';
        $this->display();
    }

    public function edit(){
        $data = $this->getField('clients', 'id,gid,nickname,sex,headimgurl,subscribe_status,subscribe_time,score,come_count,area,phone,card', array('id' => I('get.id')));
        $this->meta_title = '修改会员';
        $this->assign('data', $data);
        $this->display('update');
    }
}